# -*- coding: utf-8 -*- 
from django.db import models
#from django.core.exceptions import ObjectDoesNotExist

class Announcement(models.Model):
    title = models.CharField(verbose_name=u'Tytuł',maxlength=40)    
    text = models.TextField(verbose_name=u'Treść',help_text=u'Treść komunikatu')
    pub_date = models.DateTimeField(u'Data utworzenia',auto_now_add=True)
    def __unicode__(self):
        return self.title
    class Meta:
        verbose_name = u'Konumikat'
        verbose_name_plural = u'Komunikaty'
    class Admin:
        list_display = ("title",'pub_date')
        search_fields = ['title','text']
    def get_absolute_url(self):
        return "/announcements/%i/" % self.id